#ifndef PCF_SAMPLE_H
#define PCF_SAMPLE_H
#include "SampleBase.h"
#include "glslprogram.h"
#include "plane.h"
#include "objmesh.h"
#include "frustum.h"
namespace ShaderLab {
	class PCFSample : public SampleBase {
	public:
		PCFSample();
		~PCFSample();

		void Init();
		void Update(float time);
		void Render();
		void Imgui();
		void ShutDown();
	private:
		GLSLProgram prog;
		GLuint shadowFBO, pass1Index, pass2Index;

		std::unique_ptr<Plane> plane;
		std::unique_ptr<ObjMesh> mesh;

		Frustum lightFrustum;
		int shadowMapWidth, shadowMapHeight;
		glm::mat4 lightPV;
		glm::mat4 shadowScale;
		glm::vec3 lightPos;
		glm::mat4 model, view, projection;
	private:
		void UpdateMat();
		void CreateShader();
		void FBO();
		void DrawScene();
	};
}
#endif // !TEMPLATE_SAMPLE_H
